﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once

#include "GUiBaseInterfaceEnums.h"
#include "ICommandControlDefinition.h"

namespace gcmp
{
    /// \brief button控件数据定义接口
    class GCMP_GUI_BASE_INTERFACE_EXPORT ICommandButtonDefinition : public ICommandControlDefinition
    {
    public:
        /// \brief 创建ICommandButtonDefinition对象
        ///
        /// \param id       CommandButton控件数据定义的id,需保证唯一性
        /// \param caption    控件标题
        /// \param tooltip    控件的提示信息
        /// \param commandId  命令的id
        /// \param iconPath   图标路径
        /// \param buttonStyle  图标样式
        /// \return 创建出ICommandButtonDefinition对象。失败时返回空
        static OwnerPtr<ICommandButtonDefinition> Create(const std::wstring& id, const std::wstring& caption, const std::wstring& tooltip, const std::wstring& commandId, const std::wstring& iconPath, ButtonStyle buttonStyle = ButtonStyle::TextUnderIcon);

        /// \brief 创建pCommandButtonDefinition的引用
        ///
        /// 不能通过引用创建引用；pCommandButtonDefinition需加到IControlDefinitionLibrary时才能创建引用对象
        /// \param pCommandButtonDefinition 被引用的ICommandButtonDefinition的对象
        /// \return pCommandButtonDefinition的引用对象
        static OwnerPtr<ICommandButtonDefinition> CreateReference(const ICommandButtonDefinition* pCommandButtonDefinition);

        /// \brief 得到图标路径
        virtual std::wstring GetIconPath() const = 0;

        /// \brief 设置图标路径
        ///
        /// \param iconPath 图标路径
        /// \return  true表示成功， false表示失败
        virtual bool SetIconPath(const std::wstring& iconPath) = 0;

        /// \brief 修改button上显示的文字
        ///
        /// \param caption 待设置的文字说明
        /// \return true设置成功， false设置失败
        virtual bool SetCaption(const std::wstring& caption) = 0;

        /// \brief 得到图标样式
        virtual ButtonStyle GetButtonStyle() const = 0;

        /// \brief 设置图标样式
        ///
        /// \param style 图标样式
        /// \return  true表示成功， false表示失败
        virtual bool SetButtonStyle(ButtonStyle style) = 0;

        /// \brief 设置check状态,Ribbon上的控件设置不起作用
        ///
        /// \param isChecked 待设置的check状态
        /// \return void
        virtual void SetIsChecked(bool isChecked) = 0;

        /// \brief 获取check状态
        virtual bool IsChecked() const = 0;
    };

}   // end namespace gcmp
